HTTPS for Flask
Answered Dec 5 '20 by Mark Dominus
code:python
import ssl
context = ssl.SSLContext()
context.load_cert_chain('fullchain.pem', 'privkey.pem')
...
app.run(…, ssl_context=context)
'fullchain.pem', 'privkey.pem' are created by [LetsEncrypt Certbot
$ flask run --cert fullchain.pem --key privkey.pem
---
This page is auto-translated from /nishio/FlaskのHTTPS化. If you looks something interesting but the auto-translated English is not good enough to understand it, feel free to let me know at @nishio_en. I'm very happy to spread my thought to non-Japanese readers.